﻿#pragma once

#include <QWidget>
#include <qcustomplot.h>
class MultiCurveWidget  : public QWidget
{
	Q_OBJECT

public:
	MultiCurveWidget(const QVector<double>& xData, const QVector<QVector<double>>& yData, const QVector<QString>& curveNames, QWidget *parent=nullptr);
	~MultiCurveWidget();

private slots:
	void on_spbMCurveWidth_valueChanged(int value);
	void on_spbAveCurveWidth_valueChanged(int value);
	void on_spbFontSize_valueChanged(int value);
	void on_btnUpdate_clicked();
	void on_btnExportCurves_clicked();
	void on_chkShowLegend_stateChanged(int state);
private:
	void initUI();
	void updateCurves();

private:
	QSpinBox *spbMCurveWidth, *spbAveCurveWidth, * spbFontSize;
	QPushButton *btnUpdate,  * btnExportCurves;
	QCheckBox *chkShowLegend;
	const QVector<double> xData;
	const QVector<QVector<double>> yData;
	const QVector<QString> curveNames;
	QCustomPlot *customPlot;
};
